package com.geostar.constructionland.analyse.service.analyseresult.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.geostar.constructionland.analyse.entity.alyresult.AlyResultXzq;
import com.geostar.constructionland.analyse.mapper.sptalyresult.AlyResultXzqMapper;
import com.geostar.constructionland.analyse.service.analyseresult.AlyResultXzqService;
import com.geostar.constructionland.common.entity.logs.mongolog.YzGeoJson;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

@Service
public class AlyResultXzqServiceImpl extends ServiceImpl<AlyResultXzqMapper, AlyResultXzq> implements AlyResultXzqService {
    @Override
    public boolean saveBatchXzqGeoJson(List<AlyResultXzq> alyResultXzqList) {
        alyResultXzqList.forEach(alyResultXzq -> {
            YzGeoJson yzGeoJson = new YzGeoJson();
            String yzGeoJsonId = UUID.randomUUID().toString().replaceAll("-","");
            yzGeoJson.setId(yzGeoJsonId);
            yzGeoJson.setGeoJson(alyResultXzq.getGeojson());
            alyResultXzq.setMongoId(yzGeoJsonId);
        });
        /**先保存geoJson*/
        saveBatch(alyResultXzqList);
        return true;
    }
}
